﻿@model IEnumerable<EjemploEF5.Models.Inscripcion>

@{
    ViewBag.Title = "Index";
}

<h2>Inicio</h2>


<table>
    <tr>
         <th>
            @Html.DisplayNameFor(model => model.alumno) |
        </th>
        <th>
            @Html.DisplayNameFor(model => model.materia) |
        </th>
        <th>
            @Html.DisplayNameFor(model => model.parcial1) |
        </th>
        <th>
            @Html.DisplayNameFor(model => model.parcial2) |
        </th>
        <th>
           Promedio |
        </th>
        <th colspan="3">
            Operaciones
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.alumno.nombre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.materia.nombre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.parcial1)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.parcial2)
        </td>
        <th>
            @((item.parcial1+item.parcial2)/2)
        </th>
        <td>
            @Html.ActionLink("Modificar", "Edit", new { id=item.id }) |
            @Html.ActionLink("Ver", "Details", new { id=item.id }) |
            @Html.ActionLink("Borrar", "Delete", new { id=item.id })
        </td>
    </tr>
}

</table>


<h3>Generar nueva Inscripcion</h3>

<form action="/Inscripcion/Agregar" method="post">
    <span>
        <label>Legajo Alumno: </label>
        <input type="text" name="alu" />
    </span>
    <br />

    <span>
        <label>Codigo Materia: </label>
        <input type="text" name="mat" />
    </span>
    <br />

    <span>
        <label>Primer Parcial: </label>
        <input type="number" name="par1" />
    </span>
    <br />

    <span>
        <label>Segundo Parcial: </label>
        <input type="number" name="par2" />
    </span>
    <br />

    <span>
        <input type="submit" value="Agregar" />
    </span>
</form>

<hr />

@Html.ActionLink("Ver lista de alumnos", "Index", "Alumno")
<br />
@Html.ActionLink("Ver lista de materias", "Index", "Materia")